﻿using System;
using System.Windows.Forms;
using bbtpClient.Controllers;
using bbtpClient.Entities;

namespace bbtpClient
{
    public static class Program
    {
        public static readonly string Host = "http://localhost:12345/bbtp/";
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]

        private static void ShowUserStartupForm()
        {
            Role role = UserInfo.Role;
            switch (role)
            {
                case Role.TRANSPORT_MANAGER:
                    Application.Run(new TransportManagerStartup());
                    break;
                case Role.SALESMAN:
                    Application.Run(new SalesmanStartup());
                    break;
                case Role.CATALOG_MANAGER:
                    Application.Run(new CatalogManagerStartup());
                    break;
            }
        }

        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            LoginForm loginForm = new LoginForm();
            Application.Run(loginForm);
            if (loginForm.loginResult == Result.SUCCESS)
            {
                ShowUserStartupForm();
            }
        } 
       
        
    }
}